package DBLayer;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import ModelLayer.*;

/**
	 * @author Sang
	 * 
	 */

public class DBSaedeTest {
	
	private DBSaede dbSaedeObj;
	@Before
	public void setUp() throws Exception {
		dbSaedeObj = new DBSaede();
	}
	
	@After
	public void tearDown() throws Exception{	
	}
	
	/**
	 * Test method for {@link DBLayer.DBSaede#DBSaede()}.
	 */
	@Test
	public void testDBSaede() {
		fail("Not yet implemented");
	}

	/**
	 * Test method for {@link DBLayer.DBSaede#getAllSaede(boolean)}.
	 */
	@Test
	public void testGetAllSaede() {
		fail("Not yet implemented");
	}

	/**
	 * Test method for {@link DBLayer.DBSaede#SearchSaede(int, boolean)}.
	 */
	@Test
	public void testSearchSaede() {
		Saede SaedeObj = dbSaedeObj.getSaede(2, false);
		if (SaedeObj != null) {
			System.out.println("SaedeNr  " + SaedeObj.getSaedeNr() + "\n "
					+ "RaekkeNr     " + SaedeObj.getRaekkeNr() + "\n " + "SaedeStatus     " + SaedeObj.getSaedeStatus() + "\n " 
					+ "Sal    " + SaedeObj.getSal().getSalNr());
		} else {
			fail("Saede not found");
		}
	}

	/**
	 * Test method for
	 * {@link DBLayer.DBSaede#delete(int)}.
	 */
	@Test
	public void testDelete()
	{
		dbSaedeObj.deleteSaede(2);
	}

	/**
	 * Test method for {@link DBLayer.DBSaede#updateSaede(ModelLayer.Saede)}.
	 */
	@Test
	public void testUpdateSaede() {
		fail("Not yet implemented");
	}
	
	/**
	 * Test method for {@link DBLayer.DBSaede#insertPerson(ModelLayer.Saede)}.
	 * @throws Exception 
	 */
	@Test
	public void testInsertSaede() throws Exception {
		
		byte p = 3;
		byte p1 = 3;
		Sal sal= new Sal(p1);
		Saede saedeObject = new Saede(2, p, sal);
		dbSaedeObj.insertSaede(saedeObject);
		//Normally you would delte the saede after inserting in an insert test but because we wanted to find the saede afterwords the delete was not implemented
	}

}
